package com.ruoyi.fitsculpt.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fitsculpt.mapper.EasyfitUserGoalsMapper;
import com.ruoyi.fitsculpt.domain.EasyfitUserGoals;
import com.ruoyi.fitsculpt.service.IEasyfitUserGoalsService;

/**
 * 用户目标Service业务层处理
 *
 * @author metaee
 * @date 2025-02-27
 */
@Service
public class EasyfitUserGoalsServiceImpl implements IEasyfitUserGoalsService {
    @Autowired
    private EasyfitUserGoalsMapper easyfitUserGoalsMapper;

    /**
     * 查询用户目标
     *
     * @param goalId 用户目标主键
     * @return 用户目标
     */
    @Override
    public EasyfitUserGoals selectEasyfitUserGoalsByGoalId(Long goalId) {
        return easyfitUserGoalsMapper.selectEasyfitUserGoalsByGoalId(goalId);
    }

    /**
     * 查询用户目标列表
     *
     * @param easyfitUserGoals 用户目标
     * @return 用户目标
     */
    @Override
    public List<EasyfitUserGoals> selectEasyfitUserGoalsList(EasyfitUserGoals easyfitUserGoals) {
        return easyfitUserGoalsMapper.selectEasyfitUserGoalsList(easyfitUserGoals);
    }

    /**
     * 新增用户目标
     *
     * @param easyfitUserGoals 用户目标
     * @return 结果
     */
    @Override
    public int insertEasyfitUserGoals(EasyfitUserGoals easyfitUserGoals) {
        easyfitUserGoals.setCreateTime(DateUtils.getNowDate());
        return easyfitUserGoalsMapper.insertEasyfitUserGoals(easyfitUserGoals);
    }

    /**
     * 修改用户目标
     *
     * @param easyfitUserGoals 用户目标
     * @return 结果
     */
    @Override
    public int updateEasyfitUserGoals(EasyfitUserGoals easyfitUserGoals) {
        easyfitUserGoals.setUpdateTime(DateUtils.getNowDate());
        return easyfitUserGoalsMapper.updateEasyfitUserGoals(easyfitUserGoals);
    }

    /**
     * 批量删除用户目标
     *
     * @param goalIds 需要删除的用户目标主键
     * @return 结果
     */
    @Override
    public int deleteEasyfitUserGoalsByGoalIds(Long[] goalIds) {
        return easyfitUserGoalsMapper.deleteEasyfitUserGoalsByGoalIds(goalIds);
    }

    /**
     * 删除用户目标信息
     *
     * @param goalId 用户目标主键
     * @return 结果
     */
    @Override
    public int deleteEasyfitUserGoalsByGoalId(Long goalId) {
        return easyfitUserGoalsMapper.deleteEasyfitUserGoalsByGoalId(goalId);
    }

    /**
     * 根据ID查询用户目标
     * 
     * @param id 用户目标ID
     * @return 用户目标信息
     */
    @Override
    public EasyfitUserGoals selectEasyfitUserGoalsById(Long id) {
        return easyfitUserGoalsMapper.selectEasyfitUserGoalsById(id);
    }
}
